package com.rc.evcharger.vo.log;


import com.rc.evcharger.common.base.BaseMongoEntity;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 操作日志
 *
 * @Document 用来表明关联的mongo中的那个collection(类似于表名)
 * @Indexed 为某个字段建立索引
 * @Field 声明属性对应的数据库中的哪个字段
 */
//@Document(collection = "platform_operate_log_yyyyMM")
public class PlatformOperateLog extends BaseMongoEntity {
    private String ip;

    private String url;

    private String requestParams;

    private String operator;

//    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private String createTime;

    public PlatformOperateLog(Date date) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        this.createTime = sdf.format(date);

        this.collectionName = "platform_operate_log_" + yyyyMM.format(date);
    }

    public PlatformOperateLog() {
        Date now = new Date();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        this.createTime = sdf.format(now);

        this.collectionName = "platform_operate_log_" + yyyyMM.format(now);
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getRequestParams() {
        return requestParams;
    }

    public void setRequestParams(String requestParams) {
        this.requestParams = requestParams;
    }

    public String getOperator() {
        return operator;
    }

    public void setOperator(String operator) {
        this.operator = operator;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }
}